<template>
  <div>
    <h1>Parent</h1>
    <h2 @click="myClick">conut:{{count}}</h2>
    <Child :index="1" @changeCount="changeCount"/>
    <Child :index="2" @changeCount="count+=$event"/>
    <Child :index="3" @click="click1"/>
    <Child :index="4" @click.native="click1"/>
  </div>
</template>

<script>
import Child from './Child.vue'
export default {
    name:'Parent',
    data() {
      return {
        count:0
      }
    },
    methods: {
      myClick($event){
        console.log($event);
      },
      changeCount($event){
        this.count+=$event
      },
      click1(){
        console.log('click1触发');
      }
    },
    components:{
        Child
    }
}
</script>

<style>

</style>